package com.songshuai.pangu.api.service.impl;

import com.songshuai.pangu.api.dao.base.YixueBaseCityMapper;
import com.songshuai.pangu.api.dao.base.YixueBaseDictionaryMapper;
import com.songshuai.webapi.baseapi.model.custminiprogram.YixueBaseCity;
import com.songshuai.pangu.api.model.base.YixueBaseDictionary;
import com.songshuai.pangu.api.service.YixueBaseDictionaryService;
import com.songshuai.webapi.baseapi.constant.BaseConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: lhx
 * @Date: 2019/3/22 15:55
 */
@Service
public class YixueBaseDictionaryServiceImpl implements YixueBaseDictionaryService {


    @Autowired
    private YixueBaseDictionaryMapper baseDictionaryMapper;

    @Autowired
    private YixueBaseCityMapper yixueBaseCityMapper;


    @Override
    public List<YixueBaseDictionary> queryByType(Integer type) {
        return baseDictionaryMapper.selectByEntityList(new YixueBaseDictionary(){{
            setType(type);
            setIsdelete(BaseConstant.IS_DELETE_FLAG_NO);
        }});
    }

    @Override
    public YixueBaseDictionary queryDetail(Integer id) {
        return baseDictionaryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<YixueBaseCity> queryAreaByParentId(Integer pid) {
        YixueBaseCity  yixueBaseCity=new YixueBaseCity(){{
            setParentId(pid);
        }};
        List<YixueBaseCity> yixueBaseCities = yixueBaseCityMapper.selectByEntityList(yixueBaseCity);
        return yixueBaseCities;
    }


}
